/**
 * 导航到指定页面
 * @param url 页面路径
 */
export const navigateTo = (url: string): void => {
    uni.navigateTo({ url })
}

/**
 * 切换到指定Tab页面
 * @param url Tab页面路径
 */
export const switchTab = (url: string): void => {
    uni.switchTab({ url })
}

/**
 * 重定向到指定页面
 * @param url 页面路径
 */
export const redirectTo = (url: string): void => {
    uni.redirectTo({ url })
}

/**
 * 返回上一页
 * @param delta 返回的页面数，默认1
 */
export const navigateBack = (delta = 1): void => {
    uni.navigateBack({ delta })
}

/**
 * 导航到备孕相关页面
 */
export const preparingNavigation = {
    toPeriodTracker: () => navigateTo('/pages/preparing/period-tracker'),
    toOvulationPredictor: () => navigateTo('/pages/preparing/ovulation-predictor'),
    toFertilityWindow: () => navigateTo('/pages/preparing/fertility-window'),
    toBasalTemperature: () => navigateTo('/pages/preparing/basal-temperature'),
    toCervicalMucus: () => navigateTo('/pages/preparing/cervical-mucus'),
    toAnalysis: () => navigateTo('/pages/preparing/analysis'),
    toCheckup: () => navigateTo('/pages/preparing/checkup'),
    toNutrition: () => navigateTo('/pages/preparing/nutrition'),
    toTasks: () => navigateTo('/pages/preparing/tasks'),
    toKnowledge: () => navigateTo('/pages/knowledge/list?category=preparing')
}

/**
 * 导航到孕期相关页面
 */
export const pregnantNavigation = {
    toPregnancyStatus: () => navigateTo('/pages/pregnant/status'),
    toFetalDevelopment: () => navigateTo('/pregnancyPage/pages/fetal_growth'),
    toPregnancyDiet: () => navigateTo('/packages/pages/food_guide'),
    toPregnancyExercise: () => navigateTo('/packages/pages/food_guide'),
    toPregnancyCheckup: () => navigateTo('/pregnancyPage/pages/behavior_guide'),
    toWeightTracker: () => navigateTo('/pregnancyPage/pages/weight_management'),
    toContraction: () => navigateTo('/pages/pregnant/contraction'),
    toKickCounter: () => navigateTo('/pregnancyPage/pages/fetal_movement'),
    toHospitalBag: () => navigateTo('/pregnancyPage/pages/hospital_bag'),
    toBirthPlan: () => navigateTo('/pages/pregnant/birth-plan'),
    toKnowledge: () => navigateTo('/pages/knowledge/list?category=pregnant')
}

/**
 * 导航到产后相关页面
 */
export const postpartumNavigation = {
    toGrowthCurve: () => navigateTo('/pages/baby/growth-curve'),
    toFeeding: () => navigateTo('/pages/baby/feeding'),
    toMilestones: () => navigateTo('/pages/baby/milestones'),
    toNewbornCare: () => navigateTo('/pages/baby/newborn-care'),
    toPostpartumDepression: () => navigateTo('/pages/postpartum/depression'),
    toHealthRecord: () => navigateTo('/pages/baby/health-record'),
    toPostpartumRecovery: () => navigateTo('/pages/postpartum/recovery'),
    toFeedingGuide: () => navigateTo('/pages/baby/feeding-guide'),
    toSleepSolutions: () => navigateTo('/pages/baby/sleep-solutions'),
    toInteractionGuide: () => navigateTo('/pages/baby/interaction-guide'),
    toRecoveryDetail: () => navigateTo('/pages/postpartum/recovery-detail'),
    toGrowthTrend: () => navigateTo('/pages/baby/growth-trend'),
    toAllFeedings: () => navigateTo('/pages/baby/all-feedings'),
    toAddFeeding: () => navigateTo('/pages/baby/add-feeding'),
    toKnowledge: () => navigateTo('/pages/knowledge/list?category=postpartum')
}
